﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cesave.Domain.PermisosModule.Entities;
using Cesave.Infrastructure.Data.Core;
using Cesave.Domain.PermisosModule.Contracts.CultivosAguas;
using Cesave.Infrastructure.Data.PermisosModule.Context;
using Cesave.Infrastructure.CrossCutting.Logging;
using Cesave.Domain.Core.Specification;

namespace Cesave.Infrastructure.Data.PermisosModule.Repositories
{
	public class CultivosAguaRepository
		: GenericRepositoryEx<CultivosAgua>, ICultivosAguaRepository
	{
		#region Constructor

		/// <summary>
		/// 
		/// </summary>
		/// <param name="context"></param>
		/// <param name="traceManager"></param>
		public CultivosAguaRepository(IPermisosModuleContext context, ITraceManager traceManager)
			: base(context, traceManager)
		{
		}

		#endregion

		#region ICultivosAguaRepository Members

		/// <summary>
		/// 
		/// </summary>
		/// <param name="cultivoSpecification"></param>
		/// <param name="cicloSpecification"></param>
		/// <param name="juntaSpcification"></param>
		/// <returns></returns>
		public IEnumerable<CultivosAgua> FindCultivosAguas(CultivosAguasByCultivoSpecification cultivoSpecification, CultivosAguasByCicloSpecification cicloSpecification, CultivosAguasByJuntaSpecification juntaSpcification)
		{
			if (cultivoSpecification == null)
				throw new ArgumentNullException("cultivoSpecification");
			if (cicloSpecification == null)
				throw new ArgumentNullException("cicloSpecification");
			if (juntaSpcification == null)
				throw new ArgumentNullException("juntaSpecification");
			Specification<CultivosAgua> specification = new TrueSpecification<CultivosAgua>();
			specification &= cultivoSpecification;
			specification &= cicloSpecification;
			specification &= juntaSpcification;
			return GetBySpec(specification);
		}

		#endregion
	}
}
